<%--
 *  File:    ReportUserSummary.jsp
 *  @Author: Saraxia
 *  Date:    2012/11/5

 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
 

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="http://dcms.oval.com/page/dcms" prefix="dcms" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  	Category cat = Category.getInstance("jsp.UserSummary");  
%>

<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "UPM";
  	String strTableName = "ovuser";
	String privilegeCode = "Z0102,L401";
	String contextPath = request.getContextPath();
%>



<%
  	//get current userinfo
  	HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");
	String languagecode = (String)session.getAttribute("languagecode");
  	if(languagecode == null)
  	{
  		languagecode = "cn";
  	} 
  	Integer nCurOrgId = (Integer)CurUserInfo.get("orgid");
  	if(nCurOrgId == null)
  	{
  		nCurOrgId = new Integer(0);
  	} 
  	String strCurUserName = (String)CurUserInfo.get("username");
  	if(strCurUserName == null)
  	{
  		strCurUserName = "";
  	} 
  	Integer nCurUserId = (Integer)CurUserInfo.get("userid");
  	if(nCurUserId == null)
  	{
  		nCurUserId = new Integer(0);
  	} 
  	String isPrimaryAdmin = (String)CurUserInfo.get("isprimaryadmin");
  	if(isPrimaryAdmin == null)
  	{
    	isPrimaryAdmin = "";
  	} 
  	//give permission
  	boolean bCanUpdatePrimaryAdmin = true;
  	if(!isPrimaryAdmin.equalsIgnoreCase("Y"))
  	{
    	bCanUpdatePrimaryAdmin = false;
  	} 
%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%@ include file="/rpt/ReportURL.inc"%>

<html>
<head>
<title></title>
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/<%= strLanguageCode %>/summary.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>

<script>
isRunning=false;
</script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%@ include file="/inc/NewCalendar.inc"%>
<% //--------------------------------------  output variant from pageflow --%>
<%
  	String orgname = (String)CurUserInfo.get("orgname");

  	Integer nOrgId = (Integer)pageContext.getAttribute("orgid");
  	Vector userSummary = (Vector)pageContext.getAttribute("usersummary");
  	if(userSummary == null)
    	userSummary = new Vector();
  	
  	//HashMap userinfo = (HashMap)session.getAttribute("userinfo");
  	
  	HashMap CurUserInfo1 = (HashMap)session.getAttribute("userinfo");
    Integer employeeid=(Integer)CurUserInfo1.get("userid");
%>

<script type="text/javascript">

function page_export(){
	
	var obj=document.getElementById('status');
	var index =obj.selectedIndex;
	var status = obj.options[index].value;
 	var __username=document.getElementById("__username").value;
 	var __employeecode=document.getElementById("__employeecode").value;
 	var __employeename=document.getElementById("__employeename").value;
 	var parentuserid2=document.getElementById("parentuserid2").value;
	var obj=document.getElementById('__deptid');
	var index =obj.selectedIndex;
	var __deptid = obj.options[index].value;
	var obj=document.getElementById('jobtitle');
	var index =obj.selectedIndex;
	var jobtitle = obj.options[index].value;
	var stdareatype=document.getElementById("stdareatype").value;
	
	var url = "<%=reportURL%>/servlet/ExcecuteReport/contactinfo.sox?__format=xlsx&__folder=/ovalreport&sessionid=<%=OvalTools.randomURL()%>&username="+escape(encodeURI(__username))+"&employeecode="+__employeecode+"&employeename="+escape(encodeURI(__employeename))+"&parentuserid="+parentuserid2+"&deptid="+__deptid+"&employeeid="+<%=employeeid %>+"&stdareatype="+stdareatype+"&jobtitle="+jobtitle+"&status="+status;
	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url, "nwindow", strstatus);
    
	}
function page_bigexport(){
	
	var obj=document.getElementById('status');
	var index =obj.selectedIndex;
	var status = obj.options[index].value;
 	var __username=document.getElementById("__username").value;
 	var __employeecode=document.getElementById("__employeecode").value;
 	var __employeename=document.getElementById("__employeename").value;
 	var parentuserid2=document.getElementById("parentuserid2").value;
	var obj=document.getElementById('__deptid');
	var index =obj.selectedIndex;
	var __deptid = obj.options[index].value;
	var obj=document.getElementById('jobtitle');
	var index =obj.selectedIndex;
	var jobtitle = obj.options[index].value;
	var stdareatype=document.getElementById("stdareatype").value;
	var pivotins=document.getElementById("pivotins").value;
	
	var url = "<%=newreportURL %>/xlsrpt?reportname=contactinfo&sessionid=<%=OvalTools.randomURL()%>&username="+escape(encodeURI(__username))+"&employeecode="+__employeecode+"&employeename="+escape(encodeURI(__employeename))+"&parentuserid="+parentuserid2+"&deptid="+__deptid+"&employeeid="+<%=employeeid %>+"&stdareatype="+stdareatype+"&jobtitle="+jobtitle+"&status="+status+"&timestamp="+Date.parse(new Date())+"&pivotins="+escape(encodeURI(pivotins));
	DataReport(url);
	//var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    //popwindow = window.open(url, "nwindow", strstatus);
    
}
function page_summary(){

	var summaryRootPathBase = document.getElementById("__summaryRootPathBase").value;
    var  summaryRootPath=  summaryRootPathBase.substr(0,summaryRootPathBase.length-8);
    var summaryConfig = document.getElementById("__summaryConfigID").value;
     __summaryGo(summaryConfig,summaryRootPath+'/resource/cn/images/indicator.gif',summaryRootPathBase+'/go','');

     //var  __summaryGo(summaryConfig,summaryRootPath+'/images/cn/go.gif',summaryRootPathBase+'/go','');
}

function page_clear(){
	document.getElementById("__username").value="";
	document.getElementById("__employeecode").value="";
	document.getElementById("__employeename").value="";
	document.getElementById("parentuserid2").value="";
	document.getElementById("parentusername").value="";
	document.getElementById("parentemployeename").value="";
	document.getElementById("__deptid").options[0].selected=true;
	document.getElementById("jobtitle").options[0].selected=true;
	document.getElementById("status").options[0].selected=true;
	document.getElementById("stdareatype").value="";
	document.getElementById("strareaname").value="";

}

function poporg()
{
  window.open("../ogm/OrgSelect.jsp?<%= OvalTools.randomURL() %>&selectoption=owner&languagecode=<%= strLanguageCode %>", "newwindow", "height=250, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
}

function page_setOrg(id,name)
{
  document.getElementById("orgid").value=id;
  document.getElementById("orgname").value=name;
  page_summary('search');
}

function page_selectUser() {
	var status = "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
	var url = "<%=contextPath%>/img/UserSelectPop.jsp?o_thread=" + Math.random();
		
	if (typeof popwindow != 'undefined') popwindow.close();
	popwindow = window.open(url, "newwindow", status);
}
function page_setUser(id,code,name){
	
	document.getElementById("parentuserid2").value=id;
	document.getElementById("parentusername").value=code;
	document.getElementById("parentemployeename").value=name;
}

function page_popBusinessarea()
{
  if (typeof popwindow != 'undefined') popwindow.close();
  popwindow = window.open("<%=contextPath%>/masterdata/ogm/zylstdbusinessareapop.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>","newwindow", "height=300, width=800,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
	
}

function setContact(id,type,name){
	document.getElementById("stdareatype").value=id;
	document.getElementById("strareaname").value=name;
}

</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<% 
	String maninTabName = label.getLabelName("L_BasicInfo");
	String str = "部门属性";
	String str1 = "产品分级";
	String str3=label.getLabelName("L_PriceInfo");
	String str4=label.getLabelName("L_AttrInfo");
%>
 <dcms:summary id="usr.reportusersummary"  summaryDataName="usersummary"  needNew="true" newTabID="mainTab"  editTabID="mainTab"  needEdit="true" > 
 
  <dcms:param name="globalpccode" property="params:globalpccode"/>
  <dcms:param name="orgid" property="session:userinfo.orgid"/>
  <dcms:param name="pivotins" property="pivotinfo.pivotins"/>
  
  	<dcms:summaryTab id="mainTab" name="<%= maninTabName %>"  href="/masterdata/upm/UserEdit.jsp?orgid={session:userinfo.orgid}"/>
	<dcms:summaryAction actionFuction="__export('XLSX')" labelCode="L_ALL_Execcd" styleWidth="70"/>
	<dcms:summaryAction actionFuction="page_export" labelCode="L_Upload_Derived" styleWidth="70"/>
	<dcms:summaryAction actionFuction="page_bigexport" labelCode="L_ALL_BIG_Execcd" styleWidth="90"/>
    <dcms:otherSearchCondition>
   <iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
     <table width="100%" cellspacing="0" cellpadding="0" border="0">
          	<tr>  
          	  <%//if(privilegeSet != null && privilegeSet.contains("1000000")){%>
              <td style="text-align:right"><%= label.getLabelName("L_OwnerOrg") + label.getLabelName("L_Colon") %></td><td>						  
            	<% 
            	if (pageContext.getAttribute("orginfo") == null) {%>
            	<input type="text" name="orgname" value="<%=JspHelper.filterNull( orgname )%>" size="30" readonly>
            	<%}else{%>            	
					<custom:text name="orginfo" property="orgname" size="30" readonly="true"/>
              <%}%>
              <a onclick="poporg()"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a></td>
              <%//}%>
				<td style="text-align:right"><%= label.getLabelName("L_UserCode") + label.getLabelName("L_Colon") %></td><td><custom:text property="__username"/></td>
				<td style="text-align:right"><%= label.getLabelName("L_UserNumber") + label.getLabelName("L_Colon") %></td><td><custom:text property="__employeecode"/></td>
				<td style="text-align:right"><%= label.getLabelName("L_UUserName") + label.getLabelName("L_Colon") %></td><td><custom:text property="__employeename"/></td>
				<td style="text-align:right"><!--  <%= label.getLabelName("L_Province") + label.getLabelName("L_Colon") %>--><%= label.getLabelName("L_employeenameUp") + label.getLabelName("L_Colon") %></td>
				<td><!--<custom:text property="regionname"/>-->
				<custom:text property="parentusername" size="10" onchange="page_cleancode('emp')" />
				 <a onclick="javascript:page_selectUser();">
				 <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a> 
				 <custom:text property="parentemployeename" size="10" readonly="true" /> 
					<custom:hidden property="parentuserid2"/>
				</td>
			</tr>
			<tr>
				<td style="text-align:right"><%= label.getLabelName("L_DefaultDeptName") + label.getLabelName("L_Colon") %></td>
				<td><custom:select optionInnerTextKey="deptname" optionsName="alldepts" property="__deptid" defaultValue="------" optionValueKey="deptid"
				defaultValueCost=""/></td>
				<td style="text-align:right"> <%= label.getLabelName("L_TitleName") + label.getLabelName("L_Colon") %></td>
				<td><custom:selectdic dictType="JobTitle" property="jobtitle" defaultValue="------" defaultValueCost=""/></td>
				<td style="text-align:right"><%= label.getLabelName("L_Provicetdr") + label.getLabelName("L_Colon") %></td>
				<td><!--<custom:text property="businessareaname"/>-->
					<custom:hidden property="stdareatype" />
		           	<custom:text property="strareaname"/>
		           	<custom:hidden property="orgid"/>
		           	<a onclick="page_popBusinessarea();"><custom:button type="3" value="*"/></a>
				</td>
				<td style="text-align:right"><%= label.getLabelName("L_Status") + label.getLabelName("L_Colon") %></td>
				<td><custom:selectdic dictType="Status" property="status" valueCriteria="28,41" defaultValue="------" defaultValueCost=""/></td>
				<td colspan="2"><a href="javascript:page_summary('search')"><img src="/oval/images/cn/go_fy.gif" border="0" style="border: 1 solid #000000"></a>&nbsp;&nbsp;<button button type="button" onclick="page_clear()" class="button1" name="re" value="clear"><%= label.getLabelName("L_Clear") %></button></td>
			</tr>
        </table>
  </dcms:otherSearchCondition>  
  

 
</dcms:summary>


</body>

</html>